package com.powerhua.core.bean;

import org.springframework.beans.factory.access.BeanFactoryLocator;
import org.springframework.beans.factory.access.BeanFactoryReference;
import org.springframework.beans.factory.access.SingletonBeanFactoryLocator;

public class BeansRegisterLocator {

	private static String CONTEXT_BEANS_NAME = "contextBeanFactory";

	/**
	 * 
	 * @param beanName
	 * @return
	 */
	public static Object getBean(String beanName) {
		BeanFactoryLocator bfl = SingletonBeanFactoryLocator.getInstance();
		BeanFactoryReference bfr = bfl.useBeanFactory(CONTEXT_BEANS_NAME);
		return bfr.getFactory().getBean(beanName);
	}
}
